import Vue from 'vue'
import Router from 'vue-router'
// import HelloWorld from '@/components/HelloWorld'
// import Home from '@/components/Home'
// import About from '@/components/About'
// import User from '@/components/User'
const HelloWorld=()=>import('@/components/HelloWorld')
const Home=()=>import('@/components/Home')
const About=()=>import('@/components/About')
const User=()=>import('@/components/User')
const Homenews=()=>import('@/components/Homenews')


//1.安装vueRouter
Vue.use(Router)
//2.创建vuerouter对象




export default new Router({
  //配置路由和组件之间的应用关系
  mode:'history',
  linkActiveClass:'active',
  routes: [
    {
      path: '/',
      redirect:'/home',
      name: 'Home',
      component: Home
    },
    {
      path: '/user/:userid',      
      name: 'User',
      component: User
    },
    {
      path: '/home',      
      component: Home,
      children:[
        {
          path:'',
          redirect:'news',
          component:Homenews
        },
        {
          path:'news',
          component:Homenews
        }
      ]
    },{
      path:'/about',
      name:'About',
      component:About
    }
  ]

})
